#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>

int main() {
	int i, n, l, j, c, d, e, k;
	char a[10000];
	int b[10000];
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", &a);
		l = strlen(a);
		c = 0;
		for (j = 0; j < l; j++) {
			c = c + (int)a[j];
		}
		d = c;
		for (k = 0; d != 0; k++) {
			e = d % 2;
			d = d / 2;
			b[k] = e;
		}
		for (k = k - 1; k >= 0; k--) printf("%d", b[k]);
		printf("\n");
	}

	return 0;
}
//1050